import os

def My(pstr,oldStr,newStr):
    astr = pstr.split(oldStr)
    return newStr.join(astr)


a = "hello word!wordasdasd asd  sad a"



def ff(pstr,oldStr,newStr):
    while True:
        temp = pstr.find(oldStr) 
        if temp ==-1:
            break
        else:
            pstr = pstr[:temp] + newStr + pstr[temp+len(oldStr):]
    return pstr

print(ff(a,"word","wevsmy"))


os.walk()